package com.unittec.zk.provider.exam;

import com.unittec.zk.provider.ApplicationContextProvider;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.List;

/**
 * zk在线考试系统
 * @author bool 
 * @date 2020-03-04 19:41
 */
@SpringBootApplication(scanBasePackages = {"com.unittec.zk.provider"})
@MapperScan(basePackages = "com.baomidou.mybatisplus.core.mapper")
@EnableScheduling
@EnableCaching
@EnableAsync
@EnableHystrix
@EnableSwagger2
public class ExamApplication implements WebMvcConfigurer {

	public static void main(String[] args) {
		try {
			SpringApplication.run(ExamApplication.class, args);
			curEnvironmentOut();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static void curEnvironmentOut() {
		System.out.println("****************************************************************************");
		Environment env = ApplicationContextProvider.getBean(Environment.class);
		String profile = env.getProperty("spring.profiles.active");
		System.out.println("当前启动环境:" + profile);
		System.out.println("****************************************************************************");
	}
}